<?php

namespace app\api\model;

use think\Model;
use think\model\Merge;
use think\Request;

class ApiModel extends Merge
{
    protected $hidden = ['mp_id','is_top','weigh','status','createtime','updatetime'];
    protected $resultSetType = 'collection';

    protected function base($query)
    {
        $mpId = get_api_applet_id();
        $globalKey = [
            'mp_id'=>$mpId,
            'status'=>'normal',
        ];
        $query->where($globalKey);
    }

    public function getCreatetimeAttr($value)
    {
        return date('Y-m-d H:i',$value);
    }

    public function getUpdatetimeAttr($value)
    {
        return date('Y-m-d H:i',$value);
    }
}
